package com.jy.oms.framework.asyn.task.executor.filter;

import com.jy.oms.framework.asyn.task.constants.ConfigConstants;
import com.jy.oms.framework.asyn.task.executor.ITaskControllerFilter;
import com.jy.oms.framework.asyn.task.model.TaskGroup;
import org.springframework.stereotype.Service;

/**
 * 任务组黑白名单开关
 *
 * @author liuquan
 */
@Service
public class TaskGroupSwitchControllerFilter extends AbstractTaskBlackWhitelistFilter implements ITaskControllerFilter {

    @Override
    public boolean checkTaskGroupAbleRun(TaskGroup taskGroup) {
        return this.judgeAbleRunTask(taskGroup.getGroup());
    }

    @Override
    protected String getBlacklistConfigKey() {
        return ConfigConstants.EXECUTOR_TASK_GROUP_BLACKLIST;
    }

    @Override
    protected String getWhitelistConfigKey() {
        return ConfigConstants.EXECUTOR_TASK_GROUP_WHITELIST;
    }

    @Override
    protected String getAlarmTitle() {
        return "任务组黑白名单开关";
    }
}
